/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import interfaces.InternationalizableEntity;
import interfaces.InternationalizableEntityDescription;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author damfercer
 */
@Entity
@Table(name = "working_status", catalog = "facetoframe", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "WorkingStatus.findAll", query = "SELECT w FROM WorkingStatus w"),
    @NamedQuery(name = "WorkingStatus.findByIdWorkingStatus", query = "SELECT w FROM WorkingStatus w WHERE w.idWorkingStatus = :idWorkingStatus"),
    @NamedQuery(name = "WorkingStatus.findByDescription", query = "SELECT w FROM WorkingStatus w WHERE w.description = :description"),
    @NamedQuery(name = "WorkingStatus.findByValue", query = "SELECT w FROM WorkingStatus w WHERE w.value = :value")})
public class WorkingStatus implements Serializable,InternationalizableEntity {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "ID_WORKING_STATUS")
    private Integer idWorkingStatus;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "DESCRIPTION")
    private String description;
    @Basic(optional = false)
    @NotNull
    @Column(name = "VALUE")
    private int value;
    @OneToMany(mappedBy = "workingStatus", fetch = FetchType.LAZY)
    private List<Candidate> candidateList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "workingStatus", fetch = FetchType.LAZY)
    private List<WorkingStatusDescription> workingStatusDescriptionList;

    public WorkingStatus() {
    }

    public WorkingStatus(Integer idWorkingStatus) {
        this.idWorkingStatus = idWorkingStatus;
    }

    public WorkingStatus(Integer idWorkingStatus, String description, int value) {
        this.idWorkingStatus = idWorkingStatus;
        this.description = description;
        this.value = value;
    }

    public Integer getIdWorkingStatus() {
        return idWorkingStatus;
    }

    public void setIdWorkingStatus(Integer idWorkingStatus) {
        this.idWorkingStatus = idWorkingStatus;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getValue() {
        return value;
    }

    public void setValue(int value) {
        this.value = value;
    }

    @XmlTransient
    public List<Candidate> getCandidateList() {
        return candidateList;
    }

    public void setCandidateList(List<Candidate> candidateList) {
        this.candidateList = candidateList;
    }

    @XmlTransient
    public List<WorkingStatusDescription> getWorkingStatusDescriptionList() {
        return workingStatusDescriptionList;
    }

    public void setWorkingStatusDescriptionList(List<WorkingStatusDescription> workingStatusDescriptionList) {
        this.workingStatusDescriptionList = workingStatusDescriptionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idWorkingStatus != null ? idWorkingStatus.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof WorkingStatus)) {
            return false;
        }
        WorkingStatus other = (WorkingStatus) object;
        if ((this.idWorkingStatus == null && other.idWorkingStatus != null) || (this.idWorkingStatus != null && !this.idWorkingStatus.equals(other.idWorkingStatus))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.WorkingStatus[ idWorkingStatus=" + idWorkingStatus + " ]";
    }

    @Override
    public Integer getId() {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }

    @Override
    public List<? extends InternationalizableEntityDescription> getDescriptionsList() {
        return getWorkingStatusDescriptionList();
    }
    
}
